package com.example.educational.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

@Getter

public enum OperationEnum {
    CreateUser("create_user"),
    DeleteUser("delete_user"),
    UpdateUser("update_user");

    private final String type;


    OperationEnum(String type) {
        this.type = type;
    }

    /**
     * 根据统计编号获取对应枚举实例
     */
    public static OperationEnum getType(String type) {
        if (ObjectUtil.isNull(type)) {
            return null;
        }
        for (OperationEnum result : OperationEnum.values()) {
            if (result.type.equals(type)) {
                return result;
            }
        }
        return null;
    }
}
